use std::cell::RefCell;
use std::rc::Rc;

#[derive(Debug)]
///地面站结构体
struct GroundStation {
    radio_freq: f64, //MHz
}
fn main() {
    let base = Rc::new(RefCell::new(GroundStation { radio_freq: 87.65 }));
    println!("base: {:?}", base);
    {
        //在该作用域进行可变借用
        let mut base_2 = base.borrow_mut();
        base_2.radio_freq -= 12.34;
        println!("base_2: {:?}", base_2);
    }
    println!("base: {:?}", base);

    let mut base_3 = base.borrow_mut();
    base_3.radio_freq += 43.21;

    println!("base: {:?}", base); //被可变借走不能进行常规操作
    println!("base_3: {:?}", base_3);
}
